package cn.bonoon.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.bonoon.kernel.support.entities.AbstractEntity;

/**
 * 一条记录表示一个即时任务
 * @author jackson
 *
 */
@Entity
@Table(name = "t_idtplan", catalog = "db_n3pa_idt")
public class ImmediatePlanEntity extends AbstractEntity{

	private static final long serialVersionUID = -3772472205662242553L;

	@Column(name = "C_CATALOG", length = 50)
	private String catalog;
	/**
	 * 这个字段很重要，是对来对应这条记录使用哪个处理器来处理这一个即时计划;
	 * 一个任务的处理器是可以被用于多个计划的，所以这里的key不需要指定为唯一
	 */
	@Column(name = "C_KEY", length = 50)
	private String key;
	
	/** 任务开始的时间 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_STARTAT")
	private Date startAt;
	/** 
	 * 任务结束的时间；
	 * 
	 * 注意：开始时间和结束时间是共用的定义，每个任务可以有自己的开始时间和结束时间，
	 * 但如果超过了过期时间，则该计划不再显示； 
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_ENDAT")
	private Date endAt;
	/** 计划的过期时间 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_EXPIREAT")
	private Date expireAt;

	@Enumerated
	@Column(name = "C_STATUS")
	private ImmediatePlanStatus status;

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public Date getEndAt() {
		return endAt;
	}

	public void setEndAt(Date endAt) {
		this.endAt = endAt;
	}

	public Date getExpireAt() {
		return expireAt;
	}

	public void setExpireAt(Date expireAt) {
		this.expireAt = expireAt;
	}

	public ImmediatePlanStatus getStatus() {
		return status;
	}

	public void setStatus(ImmediatePlanStatus status) {
		this.status = status;
	}

	public Date getStartAt() {
		return startAt;
	}

	public void setStartAt(Date startAt) {
		this.startAt = startAt;
	}

	public String getCatalog() {
		return catalog;
	}

	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}
}
